package com.bjtu.boatmq.broker.service.outer;

import com.bjtu.boatmq.common.log.Log;

import java.text.SimpleDateFormat;
import java.util.Date;

public class BrokerLogger {
    private static Log logger = new Log();
    public static void write(String errCode, String errStr) {
        logger.writeError("[Broker Error " + errCode + "]: " + errStr);
    }

    public static void writeInfo(String info){
        logger.writeInfo("[Broker]: " + info);
    }

    public static void write(Exception e){
        e.printStackTrace();
        logger.writeError(e.getMessage());
    }

    private static String getDate() {
        Date date = new Date();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        String result = format.format(date);
        return result;
    }
}
